using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using SCS.Common.Models;
namespace SCS.DAL.Mapping
{
    public class MembershipUserMap : EntityTypeConfiguration<MembershipUser>
    {
        public MembershipUserMap()
        {
            // Primary Key
            this.HasKey(t => t.userID);

            // Properties
            this.Property(t => t.userID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.userName)
                .IsRequired()
                .HasMaxLength(150);

            this.Property(t => t.password)
                .IsRequired()
                .HasMaxLength(128);

            this.Property(t => t.passwordSalt)
                .HasMaxLength(128);

            this.Property(t => t.email)
                .HasMaxLength(256);

            // Table & Column Mappings
            this.ToTable("MembershipUser");
            this.Property(t => t.userID).HasColumnName("userID");
            this.Property(t => t.userName).HasColumnName("userName");
            this.Property(t => t.password).HasColumnName("password");
            this.Property(t => t.passwordSalt).HasColumnName("passwordSalt");
            this.Property(t => t.email).HasColumnName("email");
            this.Property(t => t.isLockedOut).HasColumnName("isLockedOut");
            this.Property(t => t.createDate).HasColumnName("createDate");
            this.Property(t => t.lastPasswordChangedDate).HasColumnName("lastPasswordChangedDate");
            this.Property(t => t.expiryDate).HasColumnName("expiryDate");
        }
    }
}
